<style lang="less">
  @import './login.less';
</style>

<template>
  <div class="login">
    <div class="login-con">
      <Card icon="log-in" style="opacity:0.83" title="欢迎登录" :bordered="false">
        <div class="form-con">
          <login-form  @to-forget-password="handleForgetPassword" @to-register="handleRegister" @on-success-valid="handleSubmit"></login-form>
        </div>
      </Card>
    </div>
    <vue-particles
      color="#dedede"
      :particleOpacity="0.7"
      :particlesNumber="80"
      shapeType="circle"
      :particleSize="4"
      linesColor="#dedede"
      :linesWidth="1"
      :lineLinked="true"
      :lineOpacity="0.4"
      :linesDistance="150"
      :moveSpeed="3"
      :hoverEffect="true"
      hoverMode="grab"
      :clickEffect="true"
      clickMode="push"
    >
    </vue-particles>
  </div>
</template>

<script>

import LoginForm from '../../components/login-form/login-form.vue'

export default {
  components: {
    'LoginForm': LoginForm
  },
  methods: {

    handleForgetPassword () {
      alert('to forget password')
    },

    handleRegister () {
      alert('to register')
    },

    handleSubmit ({userName, password}) {
      this.$ajax.get('http://localhost:3000/api/login', {
        name: password, password: password
      }).then((res) => {
        console.log('res', res)
        alert('logon successed')
      })
    }
  }
}
</script>

<style>

</style>
